import request from '@/utils/request'

// 获取会话列表
export function listSessions() {
  return request({
    url: '/ai/chat/session/list',
    method: 'get'
  })
}

// 创建新会话
export function createSession(data) {
  return request({
    url: '/ai/chat/session',
    method: 'post',
    data: data
  })
}

// 更新会话标题
export function updateSession(data) {
  return request({
    url: '/ai/chat/session',
    method: 'put',
    data: data
  })
}

// 删除会话
export function deleteSession(sessionId) {
  return request({
    url: '/ai/chat/session/' + sessionId,
    method: 'delete'
  })
}

// 获取会话消息列表
export function getSessionMessages(sessionId) {
  return request({
    url: '/ai/chat/message/' + sessionId,
    method: 'get'
  })
}

// 获取请求ID
export function getRequestId() {
  return request({
    url: '/ai/chat/requestId',
    method: 'get'
  })
}

// SSE聊天预请求
export function sseChat(data) {
  return request({
    url: '/ai/chat/sse',
    method: 'post',
    data: data
  })
}

// 停止生成
export function stopGeneration(requestId) {
  return request({
    url: '/ai/chat/stop/' + requestId,
    method: 'post'
  })
}
